home *** CD-ROM | disk | FTP | other *** search
- ;----------------------------------------------------------------------------
- ;File name: URAn_AV.SH Revision date: 1997.08.08
- ;Creator: Ulf Ronald Andersson Creation date: 1991.02.02
- ;(c)1991 by: Ulf Ronald Andersson All rights reserved
- ;Released as: FREEWARE (commercial sales forbidden)
- ;----------------------------------------------------------------------------
- ;File purpose: Symbol & Macro library for application message protocols
- ;
- ; AV - protocol App - serVer (originally Acc-Venus (Gemini))
- ; MP - protocol Module player (originally for Paula)
- ;
- ;----------------------------------------------------------------------------
- ;Required header declarations:
- ;
- ; .include "uran\STRUCT.SH"
- ; .include "uran\URAn_SYS.SH"
- ; .include "uran\URAn_GEM.SH"
- ; .include "uran\URAn_AV.SH"
- ;
- ;copy the above to the header of your program and 'uncomment' the includes
- ;----------------------------------------------------------------------------
- ; Library macros:
- ;
- ;AV_set_partner name_p d0 = app_id of AV partner or -1 if none available
- ;AV_send msg,args... d0 = 0 normally, but -1 on appl_write failure
- ;
- ;VA_set_partner name_p d0 = app_id of VA partner, or -1 if not available
- ;VA_send msg,args... d0 = 0 normally, but -1 on appl_write failure
- ;
- ;MP_set_partner name_p d0 = app_id of MP partner, or -1 if not available
- ;MP_send msg,args... d0 = 0 normally, but -1 on appl_write failure
- ;
- ;For AV_set_partner and VA_set_partner, a name_p of -1 causes a search for
- ;a standard AVSERVER, using four different methods.
- ;
- ;For MP_set_partner, a name_p of -1 causes a search for
- ;a standard MPSERVER, using three different methods.
- ;
- ;----------------------------------------------------------------------------
- ; Defined variables:
- ;
- ;AV_sender_id 1 W = app id of AV sender (set = global[2] by AV_set_partner)
- ;AV_partner_id 1 W = app id of AV partner (filled by AV_set_partner)
- ;AV_message 8 W used by AV_send
- ;
- ;VA_sender_id 1 W = app id of VA sender (set = global[2] by VA_set_partner)
- ;VA_partner_id 1 W = app id of VA partner (filled by VA_set_partner)
- ;VA_message 8 W used by VA_send
- ;
- ;MP_sender_id 1 W = app id of MP sender (set = global[2] by MP_set_partner)
- ;MP_partner_id 1 W = app id of MP partner (filled by MP_set_partner)
- ;MP_message 8 W used by MP_send
- ;
- ;----------------------------------------------------------------------------
- ;NB: You must include the following line somewhere after the macro calls
- ;
- ; "make AV_links"
- ;
- ;NB: That will cause the needed routines to be included at that point.
- ;NB: You may do this several times (after further calls), and at each
- ;NB: point only the 'newly' referenced routines will be added to the code.
- ;NB: A dummy reference macro exists, so routines can be added to code even
- ;NB: without calling them. The macro is '_uniref', used as below:
- ;
- ; "_uniref AV_set_partner"
- ;
- ;----------------------------------------------------------------------------
- ; The link macro and associated macro declarations
- ;
- .MACRO AV_links
- _unidef AV_set_partner
- _unidef AV_send
- _unidef VA_set_partner
- _unidef VA_send
- _unidef MP_send
- GEM_links
- .ENDM AV_links
- ;
- _unidec AV_set_partner
- _unidec AV_send
- _unidec VA_set_partner
- _unidec VA_send
- _unidec MP_send
- ;
- ;----------------------------------------------------------------------------
- ; AV_PROTOKOLL flag bits and flag words
- ;
- ; message[3]
- ;
- b_VA_SETSTATUS equ 0
- b_VA_START equ 1
- b_AV_STARTED_A equ 2
- b_VA_FONTCHANGED equ 3
- b_VA_quoting equ 4
- b_VA_PATHUPDATE equ 5
- ;
- w_VA_SETSTATUS equ 1<<0
- w_VA_START equ 1<<1
- w_AV_STARTED_A equ 1<<2
- w_VA_FONTCHANGED equ 1<<3
- w_VA_quoting equ 1<<4
- w_VA_PATHUPDATE equ 1<<5
- ;
- ;----------------------------------------------------------------------------
- ; AV_PROTOSTATUS flag bits and flag words
- ;
- ; message[3]
- ;
- b_AV_SENDKEY equ 0
- b_AV_ASKFILEFONT equ 1
- b_AV_console equ 2
- b_AV_ASKOBJECT equ 3
- b_AV_OPENWIND equ 4
- b_AV_STARTPROG equ 5
- b_AV_accwind equ 6
- b_AV_status equ 7
- b_AV_COPYDRAGGED equ 8
- b_AV_updwhatdrag equ 9
- b_AV_EXIT equ 10
- b_AV_XWIND equ 11
- b_AV_FONTCHANGED equ 12
- b_AV_STARTED_V equ 13
- b_AV_quoting equ 14
- b_AV_FILEINFO equ 15
- ;
- w_AV_SENDKEY equ 1<<0
- w_AV_ASKFILEFONT equ 1<<1
- w_AV_console equ 1<<2
- w_AV_ASKOBJECT equ 1<<3
- w_AV_OPENWIND equ 1<<4
- w_AV_STARTPROG equ 1<<5
- w_AV_accwind equ 1<<6
- w_AV_status equ 1<<7
- w_AV_COPYDRAGGED equ 1<<8
- w_AV_updwhatdrag equ 1<<9
- w_AV_EXIT equ 1<<10
- w_AV_XWIND equ 1<<11
- w_AV_FONTCHANGED equ 1<<12
- w_AV_STARTED_V equ 1<<13
- w_AV_quoting equ 1<<14
- w_AV_FILEINFO equ 1<<15
- ;
- ; message[4]
- ;
- b_AV_COPYFILE equ 16
- b_AV_DELFILE equ 17
- b_AV_VIEW equ 18
- b_AV_SETWINDPOS equ 19
- ;
- w_AV_COPYFILE equ 1<<16
- w_AV_DELFILE equ 1<<17
- w_AV_VIEW equ 1<<18
- w_AV_SETWINDPOS equ 1<<19
- ;
- ;----------------------------------------------------------------------------
- ; Message codes
- ;
- ;------------------------------------
- ; Mandatory
- ;
- AV_PROTOKOLL equ $4700 ;(flags, res1, res2, acc_name_p)
- __AV_PROTOKOLL equ $00002603
- VA_PROTOSTATUS equ $4701 ;(flags, res1, res2, acc_name_p)
- __VA_PROTOSTATUS equ $00002603
- ;
- ;------------------------------------
- ; needs b_AV_EXIT on Venus
- ;
- AV_EXIT equ $4736 ;(acc_app_id)
- __AV_EXIT equ $00000003
- ;
- ;------------------------------------
- ; needs b_AV_SENDKEY on Venus
- ;
- AV_SENDKEY equ $4710 ;(kbshift,scan_asc)
- __AV_SENDKEY equ $00000403
- ;
- ;------------------------------------
- ; needs b_AV_STARTPROG on Venus
- ;
- AV_STARTPROG equ $4722 ;(path_fname_p, cmd_line_p, call_shake)
- __AV_STARTPROG equ $00072523
- VA_PROGSTART equ $4723 ;(start_f, ret_code, dummy1, dummy2, call_shake)
- __VA_PROGSTART equ $00070403
- ;
- ;------------------------------------
- ; needs b_VA_START in Acc
- ;
- VA_START equ $4711 ;(cmd_line_p) cmd_line_p may be NULL
- __VA_START equ $00000023
- ;
- ;------------------------------------
- ; needs both b_AV_STARTED_V on venus, and b_AV_STARTED_A in Acc
- ;
- AV_STARTED equ $4738 ;(cmd_line_p) cmd_line_p identical to that in VA_START
- __AV_STARTED equ $00000023
- ;
- ;------------------------------------
- ; needs b_AV_accwind on Venus
- ;
- AV_ACCWINDOPEN equ $4724 ;(wind_h)
- __AV_ACCWINDOPEN equ $00000003
- VA_DRAGACCWIND equ $4725 ;(wind_h, x, y, cmd_line_p)
- __VA_DRAGACCWIND equ $26050403
- AV_ACCWINDCLOSED equ $4726 ;(wind_h)
- __AV_ACCWINDCLOSED equ $00000003
- ;
- ;------------------------------------
- ; needs b_AV_COPYDRAGGED on Venus
- ;
- AV_COPYDRAGGED equ $4728 ;(kbshift, destpath_p)
- __AV_COPYDRAGGED equ $00002403
- VA_COPYCOMPLETE equ $4729 ;(change_f)
- __VA_COPYCOMPLETE equ $00000003
- ;
- ;------------------------------------
- ; needs b_AV_ASKFILEFONT on Venus
- ;
- AV_ASKFILEFONT equ $4712 ;()
- __AV_ASKFILEFONT equ $00000000
- VA_FILEFONT equ $4713 ;(font_id, font_points)
- __VA_FILEFONT equ $00000403
- ;
- ;------------------------------------
- ; needs b_AV_OPENWIND on Venus
- ;
- AV_OPENWIND equ $4720 ;(windpath_p, wildcard_p)
- __AV_OPENWIND equ $00002523
- VA_WINDOPEN equ $4721 ;(opened_f)
- __VA_WINDOPEN equ $00000003
- ;
- ;------------------------------------
- ; needs b_AV_XWIND on Venus
- ;
- AV_XWIND equ $4740 ;(windpath_p, wildcard_p, x_f)
- __AV_XWIND equ $00072523
- VA_XOPEN equ $4741 ;(opened_f)
- __VA_XOPEN equ $00000003
- ;
- ;------------------------------------
- ; needs b_AV_ASKOBJECT on Venus
- ;
- AV_ASKOBJECT equ $4716 ;()
- __AV_ASKOBJECT equ $00000000
- VA_OBJECT equ $4717 ;(->cmd_line_p)
- __VA_OBJECT equ $00000023
- ;
- ;------------------------------------
- ; needs b_AV_updwhatdrag on Venus
- ;
- AV_WHATIZIT equ $4732 ;(X, Y)
- __AV_WHATIZIT equ $00000403
- VA_THATIZIT equ $4733 ;(owner_id, type, obj_name_p)
- __VA_THATIZIT equ $00250403
- AV_PATHUPDATE equ $4730 ;(updpath_p) NB: asolute path!
- __AV_PATHUPDATE equ $00000023
- AV_DRAGONWINDOW equ $4734 ;(x,y,kbshift,cmd_line_p)
- __AV_DRAGONWINDOW equ $26050403
- VA_DRAGCOMPLETE equ $4735 ;(change_f)
- __VA_DRAGCOMPLETE equ $00000003
- VA_FONTCHANGED equ $4739 ;(filefont_id,filefont_pts,con_font_id,con_font_pts)
- __VA_FONTCHANGED equ $06050403
- ;
- ;------------------------------------
- ; needs b_AV_console on Venus
- ;
- AV_OPENCONSOLE equ $4718 ;()
- __AV_OPENCONSOLE equ $00000000
- VA_CONSOLEOPEN equ $4719 ;(opened_f)
- __VA_CONSOLEOPEN equ $00000003
- AV_ASKCONFONT equ $4714 ;()
- __AV_ASKCONFONT equ $00000000
- VA_CONFONT equ $4715 ;(font_id,font_pts)
- __VA_CONFONT equ $00000403
- ;
- ;------------------------------------
- ; needs b_AV_status on Venus
- ;
- AV_GETSTATUS equ $4703 ;()
- __AV_GETSTATUS equ $00000000
- AV_STATUS equ $4704 ;(status_s_p)
- __AV_STATUS equ $00000023
- ;
- ;------------------------------------
- ; needs b_VA_SETSTATUS in Acc
- ;
- VA_SETSTATUS equ $4705 ;(status_s_p)
- __VA_SETSTATUS equ $00000023
- ;
- ;----------------------------------------------------------------------------
- ; need THING (or other server made late 1995 or later)
- ;
- AV_VIEW equ $4751 ;(pathfname_p)
- __AV_VIEW equ $00000023
- AV_VIEWED equ $4752 ;(OK_f)
- __AV_VIEWED equ $00000003
- AV_FILEINFO equ $4753 ;(cmd_line_p)
- __AV_FILEINFO equ $00000023
- VA_FILECHANGED equ $4754 ;(cmd_line_p) same as in AV_FILEINFO, but names may have changed
- __VA_FILECHANGED equ $00000023
- AV_COPYFILE equ $4755 ;(cmd_line_p, destpath_p, opmode_f) b0=move b1=rename b2=overwrite
- __AV_COPYFILE equ $00072523
- VA_FILECOPIED equ $4756 ;(OK_f)
- __VA_FILECOPIED equ $00000003
- AV_DELFILE equ $4757 ;(cmd_line_p)
- __AV_DELFILE equ $00000023
- VA_FILEDELETED equ $4758 ;(OK_f)
- __VA_FILEDELETED equ $00000003
- AV_SETWINDPOS equ $4759 ;(x,y,w,h)
- __AV_SETWINDPOS equ $06050403
- VA_PATHUPDATE equ $4760 ;(changed_path_p) NB: assume subfolders need rereading
- __VA_PATHUPDATE equ $00000023
- ;
- ;
- ; MP-protocol messages
- ;
- MP_ACK equ $4800 ;Paula says OK to last command
- __MP_ACK equ $00000000
- MP_NAK equ $4801 ;Paula says NO to last command
- __MP_NAK equ $00000000
- ;The two above have msg[7] = Paula version : V2.4 => $0204
- ;
- MP_START equ $4802 ;Arguments like VA_START => reply ACK/NAK
- __MP_START equ $00000023
- ;Reply ACK means the command string may be reused
- ;
- ;The two below release module RAM
- MP_STOP equ $4803 ;=> reply ACK
- __MP_STOP equ $00000000
- MP_SHUTDOWN equ $4804 ;=> reply ACK
- __MP_SHUTDOWN equ $00000000
- ;
- ;----------------------------------------------------------------------------
- ;Start of: Macro definitions
- ;----------------------------------------------------------------------------
- ;int16 AV_set_partner(char *name);
- ;
- .MACRO AV_set_partner.mode name
- _uniref AV_set_partner
- PUREC_func.mode AV_set_partner,1,3,name
- .ENDM AV_set_partner
- ;
- .MACRO code_AV_set_partner
- movem.l d1-d2/a0-a2,-(sp)
- move global+4,AV_sender_id
- move.l a0,addrin ;check for special app name
- bmi.s .seek_partner
- sub_aes #appl_find
- move intout,AV_partner_id
- bra .done
- ;
- .seek_partner:
- move.l #.pad8_AVSERVER_s,addrin ;check for app named "AVSERVER"
- sub_aes #appl_find
- move intout,AV_partner_id
- bpl .done
- move.l #.AVSERVER_eq_s,addrin+4 ;check environment for 'AVSERVER='
- move.l #.AVSERVER_name_p,addrin
- sub_aes #shel_envrn
- move #-1,AV_partner_id
- tst intout
- beq.s .not_env_partner
- lea .AVSERVER_name_s,a1
- move.l .AVSERVER_name_p,a0
- moveq #' ',d1
- moveq #8-1,d2
- .pad_8_loop:
- move.b (a0)+,(a1)+
- bne.s .next_char
- subq #1,a0
- move.b d1,-1(a1)
- .next_char:
- dbra d2,.pad_8_loop
- move.l #.AVSERVER_name_s,addrin
- sub_aes #appl_find
- move intout,AV_partner_id
- bpl.s .done
- .not_env_partner:
- move.l #.pad8_THING_s,addrin ;check for app named "THING "
- sub_aes #appl_find
- move intout,AV_partner_id
- bpl.s .done
- move.l #.pad8_GEMINI_s,addrin ;check for app named "GEMINI "
- sub_aes #appl_find
- move intout,AV_partner_id
- .done:
- movem.l (sp)+,d1-d2/a0-a2
- move AV_partner_id,d0 ;d0 = app_id of AVSERVER or -1 (flagged)
- rts
- ;
- .pad8_THING_s:
- dc.b 'THING ',NUL
- .pad8_GEMINI_s:
- dc.b 'GEMINI ',NUL
- .pad8_AVSERVER_s:
- dc.b 'AVSERVER',NUL
- .AVSERVER_eq_s:
- dc.b 'AVSERVER=',NUL
- .AVSERVER_name_s:
- ds.b 9
- even
- .AVSERVER_name_p:
- dc.l 0
- .ENDM code_AV_set_partner
- ;
- ;------------------------------------
- ;
- .MACRO AV_send.mode AV_msg,arg1,arg2,arg3,arg4,arg5
- _uniref AV_send
- __AV_flag = __AV_&AV_msg
- .IFB AV_msg
- .ERROR AV_send used without any message code
- .EXITM
- .ENDIF
- .IFNB arg5
- .ERROR "AV_send used with more than 5 arguments"
- .ERROR "acceptable args = '&AV_msg,&arg1,&arg2,&arg3,&arg4'"
- .ERROR "incorrect arg = 'arg 5'"
- .ENDIF
- jsr AV_preclear
- move #(AV_&AV_msg)&$FFFF,AV_message
- .IFNB arg1
- __AV_arg.mode 0,arg1
- .IFNB arg2
- __AV_arg.mode 1,arg2
- .IFNB arg3
- __AV_arg.mode 2,arg3
- .IFNB arg4
- __AV_arg.mode 3,arg4
- .ENDIF arg4
- .ENDIF arg3
- .ENDIF arg2
- .ENDIF arg1
- jsr code_AV_send
- .ENDM AV_send
- ;
- .MACRO code_AV_send
- movem.l d1-d2/a0-a2,-(sp)
- move AV_partner_id(pc),d0
- bpl.s .send_it_1
- AV_set_partner -1.w
- bmi.s .error
- .send_it_1:
- move AV_sender_id(pc),d0
- bpl.s .send_it_2
- move global+4,AV_sender_id
- .send_it_2:
- lea AV_message(pc),a0
- clr 4(a0)
- move AV_sender_id(pc),2(a0)
- gem_aes appl_write,AV_partner_id(pc),#16,AV_message(pc)
- moveq #E_ACCDN,d0
- tst intout
- beq.s .exit
- clr.l d0
- .exit:
- movem.l (sp)+,d1-d2/a0-a2
- tst d0
- rts
- ;
- .error:
- moveq #E_INVFN,d0
- bra.s .exit
- ;
- AV_preclear:
- clr.l AV_message
- clr.l AV_message+4
- clr.l AV_message+8
- clr.l AV_message+12
- rts
- ;
- AV_message:
- ds.w 8
- AV_sender_id:
- dc.w -1
- AV_partner_id:
- dc.w -1
- .ENDM code_AV_send
- ;
- ;------------------------------------
- ;
- .MACRO VA_set_partner.mode name
- _uniref VA_set_partner
- PUREC_func.mode VA_set_partner,1,3,name
- .ENDM VA_set_partner
- ;
- .MACRO code_VA_set_partner
- movem.l d1-d2/a0-a2,-(sp)
- move global+4,VA_sender_id
- move.l d0,addrin
- bmi.s .seek_partner
- sub_aes #appl_find
- move intout,VA_partner_id
- bra .done
- ;
- .seek_partner:
- move.l #.pad8_AVSERVER_s,addrin ;check for app named "AVSERVER"
- sub_aes #appl_find
- move intout,VA_partner_id
- bpl .done
- move.l #.AVSERVER_eq_s,addrin+4 ;check environment for 'AVSERVER='
- move.l #.AVSERVER_name_p,addrin
- sub_aes #shel_envrn
- move #-1,VA_partner_id
- tst intout
- beq.s .not_env_partner
- lea .AVSERVER_name_s,a1
- move.l .AVSERVER_name_p,a0
- moveq #' ',d1
- moveq #8-1,d2
- .pad_8_loop:
- move.b (a0)+,(a1)+
- bne.s .next_char
- subq #1,a0
- move.b d1,-1(a1)
- .next_char:
- dbra d2,.pad_8_loop
- move.l #.AVSERVER_name_s,addrin
- sub_aes #appl_find
- move intout,VA_partner_id
- bpl.s .done
- .not_env_partner:
- move.l #.pad8_THING_s,addrin ;check for app named "THING "
- sub_aes #appl_find
- move intout,VA_partner_id
- bpl.s .done
- move.l #.pad8_GEMINI_s,addrin ;check for app named "GEMINI "
- sub_aes #appl_find
- move intout,VA_partner_id
- .done:
- movem.l (sp)+,d1-d2/a0-a2
- move VA_partner_id,d0 ;d0 = app_id of VA partner or -1 (flagged)
- rts
- ;
- .pad8_THING_s:
- dc.b 'THING ',NUL
- .pad8_GEMINI_s:
- dc.b 'GEMINI ',NUL
- .pad8_AVSERVER_s:
- dc.b 'AVSERVER',NUL
- .AVSERVER_eq_s:
- dc.b 'AVSERVER=',NUL
- .AVSERVER_name_s:
- ds.b 9
- even
- .AVSERVER_name_p:
- dc.l 0
- .ENDM VA_set_partner_code
- ;
- ;------------------------------------
- ;
- .MACRO VA_send.mode VA_msg,arg1,arg2,arg3,arg4
- _uniref VA_send
- __VA_flag = __VA_&VA_msg
- .IFB VA_msg
- .ERROR VA_send used without any message code
- .EXITM
- .ENDIF
- .IFNB arg5
- .ERROR "VA_send used with more than 5 arguments"
- .ERROR "acceptable args = '&VA_msg,&arg1,&arg2,&arg3,&arg4'"
- .ERROR "incorrect arg = 'arg 5'"
- .ENDIF
- jsr VA_preclear
- move #(VA_&VA_msg)&$FFFF,VA_message
- .IFNB arg1
- __VA_arg.mode 0,arg1
- .IFNB arg2
- __VA_arg.mode 1,arg2
- .IFNB arg3
- __VA_arg.mode 2,arg3
- .IFNB arg4
- __VA_arg.mode 3,arg4
- .ENDIF arg4
- .ENDIF arg3
- .ENDIF arg2
- .ENDIF arg1
- jsr code_VA_send
- .ENDM VA_send
- ;
- .MACRO code_VA_send
- movem.l d1-d2/a0-a2,-(sp)
- move VA_partner_id(pc),d0
- bpl.s .send_it_1
- VA_set_partner -1.w
- bmi.s .error
- .send_it_1:
- move VA_sender_id(pc),d0
- bpl.s .send_it_2
- move global+4,VA_sender_id
- .send_it_2:
- lea VA_message(pc),a0
- clr 4(a0)
- move VA_sender_id(pc),2(a0)
- GEM_AES appl_write,VA_partner_id,#16,VA_message(pc)
- moveq #E_ACCDN,d0
- tst intout
- beq.s .exit
- clr.l d0
- .exit:
- movem.l (sp)+,d1-d2/a0-a2
- tst d0
- rts
- ;
- .error:
- moveq #E_INVFN,d0
- bra.s .exit
- ;
- VA_preclear:
- clr.l VA_message
- clr.l VA_message+4
- clr.l VA_message+8
- clr.l VA_message+12
- rts
- ;
- VA_message:
- ds.w 8
- VA_sender_id:
- dc.w -1
- VA_partner_id:
- dc.w -1
- .ENDM code_VA_send
- ;
- ;------------------------------------
- ;
- .MACRO __AV_arg.mode argnum,argval
- __AV_type set (__AV_flag>>(8*argnum+4)) & 3
- __AV_pos set ((__AV_flag>>(8*argnum)) & 7)*2
- .IF (__AV_type==0)
- move argval,AV_message+__AV_pos
- .EXITM
- .ENDIF type==0
- .IF (__AV_type==1)
- move.l argval,AV_message+__AV_pos
- .EXITM
- .ENDIF type==1
- .IF (__AV_type==2)
- .IF '&.mode'=='.i'
- move.l argval,AV_message+__AV_pos
- .ELSE
- pea argval
- move.l (sp)+,AV_message+__AV_pos
- .ENDIF mode
- .ENDIF type==2
- .ENDM __AV_arg
- ;
- ;------------------------------------
- ;
- .MACRO __VA_arg.mode argnum,argval
- __VA_type set (__VA_flag>>(8*argnum+4)) & 3
- __VA_pos set ((__VA_flag>>(8*argnum)) & 7)*2
- .IF (__VA_type==0)
- move argval,VA_message+__VA_pos
- .EXITM
- .ENDIF type==0
- .IF (__VA_type==1)
- move.l argval,VA_message+__VA_pos
- .EXITM
- .ENDIF type==1
- .IF (__VA_type==2)
- .IF '&.mode'=='.i'
- move.l argval,VA_message+__VA_pos
- .ELSE
- pea argval
- move.l (sp)+,VA_message+__VA_pos
- .ENDIF mode
- .ENDIF type==2
- .ENDM __VA_arg
- ;
- ;------------------------------------
- ;
- .MACRO MP_set_partner.mode name
- _uniref MP_set_partner
- PUREC_func.mode MP_set_partner,1,3,name
- .ENDM MP_set_partner
- ;
- .MACRO code_MP_set_partner
- movem.l d1-d2/a0-a2,-(sp)
- move global+4,MP_sender_id
- move.l d0,addrin
- bmi.s .seek_partner
- sub_aes #appl_find
- move intout,MP_partner_id
- bra .done
- ;
- .seek_partner:
- move.l #.pad8_MPSERVER_s,addrin ;check for app named "MPSERVER"
- sub_aes #appl_find
- move intout,MP_partner_id
- bpl .done
- move.l #.MPSERVER_eq_s,addrin+4 ;check environment for 'MPSERVER='
- move.l #.MPSERVER_name_p,addrin
- sub_aes #shel_envrn
- move #-1,MP_partner_id
- tst intout
- beq.s .not_env_partner
- lea .MPSERVER_name_s,a1
- move.l .MPSERVER_name_p,a0
- moveq #' ',d1
- moveq #8-1,d2
- .pad_8_loop:
- move.b (a0)+,(a1)+
- bne.s .next_char
- subq #1,a0
- move.b d1,-1(a1)
- .next_char:
- dbra d2,.pad_8_loop
- move.l #.MPSERVER_name_s,addrin
- sub_aes #appl_find
- move intout,MP_partner_id
- bpl.s .done
- .not_env_partner:
- move.l #.pad8_PAULA_s,addrin ;check for app named "PAULA "
- sub_aes #appl_find
- move intout,MP_partner_id
- .done:
- movem.l (sp)+,d1-d2/a0-a2
- move MP_partner_id,d0 ;d0 = app_id of MP partner or -1 (flagged)
- rts
- ;
- .pad8_PAULA_s:
- dc.b 'PAULA ',NUL
- .pad8_MPSERVER_s:
- dc.b 'MPSERVER',NUL
- .MPSERVER_eq_s:
- dc.b 'MPSERVER=',NUL
- .MPSERVER_name_s:
- ds.b 9
- even
- .MPSERVER_name_p:
- dc.l 0
- .ENDM MP_set_partner_code
- ;
- ;------------------------------------
- ;
- .MACRO MP_send.mode MP_msg,arg1,arg2,arg3,arg4
- _uniref MP_send
- __MP_flag = __MP_&MP_msg
- .IFB MP_msg
- .ERROR MP_send used without any message code
- .EXITM
- .ENDIF
- .IFNB arg5
- .ERROR "MP_send used with more than 5 arguments"
- .ERROR "acceptable args = '&MP_msg,&arg1,&arg2,&arg3,&arg4'"
- .ERROR "incorrect arg = 'arg 5'"
- .ENDIF
- jsr MP_preclear
- move #(MP_&MP_msg)&$FFFF,MP_message
- .IFNB arg1
- __MP_arg.mode 0,arg1
- .IFNB arg2
- __MP_arg.mode 1,arg2
- .IFNB arg3
- __MP_arg.mode 2,arg3
- .IFNB arg4
- __MP_arg.mode 3,arg4
- .ENDIF arg4
- .ENDIF arg3
- .ENDIF arg2
- .ENDIF arg1
- jsr code_MP_send
- .ENDM MP_send
- ;
- .MACRO code_MP_send
- movem.l d1-d2/a0-a2,-(sp)
- move MP_partner_id(pc),d0
- bpl.s .send_it_1
- MP_set_partner -1.w
- bmi.s .error
- .send_it_1:
- move MP_sender_id(pc),d0
- bpl.s .send_it_2
- move global+4,MP_sender_id
- .send_it_2:
- lea MP_message(pc),a0
- clr 4(a0)
- move MP_sender_id(pc),2(a0)
- GEM_AES appl_write,MP_partner_id,#16,MP_message(pc)
- moveq #E_ACCDN,d0
- tst intout
- beq.s .exit
- clr.l d0
- .exit:
- movem.l (sp)+,d1-d2/a0-a2
- tst d0
- rts
- ;
- .error:
- moveq #E_INVFN,d0
- bra.s .exit
- ;
- MP_preclear:
- clr.l MP_message
- clr.l MP_message+4
- clr.l MP_message+8
- clr MP_message+12
- move #$0204,message+14
- rts
- ;
- MP_message:
- ds.w 8
- MP_sender_id:
- dc.w -1
- MP_partner_id:
- dc.w -1
- .ENDM code_MP_send
- ;
- ;------------------------------------
- ;
- .MACRO __MP_arg.mode argnum,argval
- __MP_type set (__MP_flag>>(8*argnum+4)) & 3
- __MP_pos set ((__MP_flag>>(8*argnum)) & 7)*2
- .IF (__MP_type==0)
- move argval,MP_message+__MP_pos
- .EXITM
- .ENDIF type==0
- .IF (__MP_type==1)
- move.l argval,MP_message+__MP_pos
- .EXITM
- .ENDIF type==1
- .IF (__MP_type==2)
- .IF '&.mode'=='.i'
- move.l argval,MP_message+__MP_pos
- .ELSE
- pea argval
- move.l (sp)+,MP_message+__MP_pos
- .ENDIF mode
- .ENDIF type==2
- .ENDM __MP_arg
- ;
- ;----------------------------------------------------------------------------
- ;End of file: URAn_AV.SH
- ;----------------------------------------------------------------------------
-